﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Rendering.RenderPipeline
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using System.Collections.Generic;

#nullable disable
namespace UnityEngine.Rendering
{
  /// <summary>
  ///   <para>Defines a series of commands and settings that describes how Unity renders a frame.</para>
  /// </summary>
  public abstract class RenderPipeline
  {
    /// <summary>
    ///   <para>Entry point method that defines custom rendering for this RenderPipeline.</para>
    /// </summary>
    /// <param name="context"></param>
    /// <param name="cameras"></param>
    protected abstract void Render(ScriptableRenderContext context, Camera[] cameras);

    protected virtual void ProcessRenderRequests(
      ScriptableRenderContext context,
      Camera camera,
      List<Camera.RenderRequest> renderRequests)
    {
    }

    /// <summary>
    ///   <para>Calls the RenderPipelineManager.beginFrameRendering delegate.</para>
    /// </summary>
    /// <param name="context"></param>
    /// <param name="cameras"></param>
    protected static void BeginFrameRendering(ScriptableRenderContext context, Camera[] cameras)
    {
      RenderPipelineManager.BeginContextRendering(context, new List<Camera>((IEnumerable<Camera>) cameras));
    }

    protected static void BeginContextRendering(
      ScriptableRenderContext context,
      List<Camera> cameras)
    {
      RenderPipelineManager.BeginContextRendering(context, cameras);
    }

    /// <summary>
    ///   <para>Calls the RenderPipelineManager.beginCameraRendering delegate.</para>
    /// </summary>
    /// <param name="context"></param>
    /// <param name="camera"></param>
    protected static void BeginCameraRendering(ScriptableRenderContext context, Camera camera)
    {
      RenderPipelineManager.BeginCameraRendering(context, camera);
    }

    protected static void EndContextRendering(ScriptableRenderContext context, List<Camera> cameras)
    {
      RenderPipelineManager.EndContextRendering(context, cameras);
    }

    /// <summary>
    ///   <para>Calls the RenderPipelineManager.endFrameRendering delegate.</para>
    /// </summary>
    /// <param name="context"></param>
    /// <param name="cameras"></param>
    protected static void EndFrameRendering(ScriptableRenderContext context, Camera[] cameras)
    {
      RenderPipelineManager.EndContextRendering(context, new List<Camera>((IEnumerable<Camera>) cameras));
    }

    /// <summary>
    ///   <para>Calls the RenderPipelineManager.endCameraRendering delegate.</para>
    /// </summary>
    /// <param name="context"></param>
    /// <param name="camera"></param>
    protected static void EndCameraRendering(ScriptableRenderContext context, Camera camera)
    {
      RenderPipelineManager.EndCameraRendering(context, camera);
    }

    protected virtual void Render(ScriptableRenderContext context, List<Camera> cameras)
    {
      this.Render(context, cameras.ToArray());
    }

    internal void InternalRender(ScriptableRenderContext context, List<Camera> cameras)
    {
      if (this.disposed)
        throw new ObjectDisposedException(string.Format("{0} has been disposed. Do not call Render on disposed a RenderPipeline.", (object) this));
      this.Render(context, cameras);
    }

    internal void InternalRenderWithRequests(
      ScriptableRenderContext context,
      List<Camera> cameras,
      List<Camera.RenderRequest> renderRequests)
    {
      if (this.disposed)
        throw new ObjectDisposedException(string.Format("{0} has been disposed. Do not call Render on disposed a RenderPipeline.", (object) this));
      this.ProcessRenderRequests(context, cameras == null || cameras.Count == 0 ? (Camera) null : cameras[0], renderRequests);
    }

    /// <summary>
    ///   <para>Returns true when the RenderPipeline is invalid or destroyed.</para>
    /// </summary>
    public bool disposed { get; private set; }

    internal void Dispose()
    {
      this.Dispose(true);
      GC.SuppressFinalize((object) this);
      this.disposed = true;
    }

    protected virtual void Dispose(bool disposing)
    {
    }

    public virtual RenderPipelineGlobalSettings defaultSettings
    {
      get => (RenderPipelineGlobalSettings) null;
    }
  }
}
